package cn.dqy.gotanserver.support.msghandle;

import cn.dqy.gotanserver.dto.GoTanInet;
import cn.dqy.gotanserver.dto.GoTanObject;
import cn.dqy.gotanserver.support.msghandle.impl.VideoStreamMsgProcess;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;

public interface MsgProcessInterface {
    static Logger logger = LoggerFactory.getLogger(MsgProcessInterface.class);

    void process(GoTanInet inetPack, GoTanObject headPack,String ipAndPortKey);

    default void saveFile(String path,byte[] data){
        try {
            logger.info("开始写入文件 path={}",path);
            FileUtils.writeByteArrayToFile(new File(path),data);
            logger.info("文件保存成功！");
        } catch (IOException e) {
            e.printStackTrace();
            logger.error("保存异常，原因"+e);
        }
    }
}
